﻿using System;
using System.Data;
using System.Configuration;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml;
using System.IO;
using System.Text;
using Newtonsoft.Json;
using System.Data.OleDb;
using System.Data.SqlClient;
using System.Data.Odbc;
using ADOX;

/// <summary>
/*
	wxyJS V2.0 CS#辅助class
	wxyJS V2.0开发编写者：辛酉戊戌戊寅（网络用户），中国居民身份证号： 230104198110270213。
	wxyJS V2.0开发起始期：2015年1月1日
	wxyJS V2.0开发结束日期：持续更新中……
	wxyJS V2.0遵循开源协议 Apache License 标准。请后续使用者了解Apache License 标准后使用。
	使用提示：
		1、本文件为wxyJS V2.0的C#辅助组成部分，与wxyJS V2.0遵循开源协议 Apache License 标准。
        2、本文件需要拷贝到项目App_Code文件夹下使用。
*/
/// </summary>
public class wxyS_DataS_1
{
    #region ClassTOP
    public SqlConnection MSSqlCon_01;//实例预设sqlserver的连接池
    public OleDbConnection AccCon_01;//实例预设ACCESS的连接池
    String JSonDZ1 = HttpContext.Current.Server.MapPath("~/File/json/data_xx.json");
    internal String _SQLPD1;
    public String SQLPD1
    {
        get
        {
            return _SQLPD1;
        }
        set
        {
            _SQLPD1 = value;
        }
    }//_IDU_01_D1
	public wxyS_DataS_1()
	{
        //HttpContext.Current.Response.Write("OK");
        //
		// TODO: 在此处添加构造函数逻辑
		//
    }//wxyS_DataS_1
    #endregion

    #region MSSQL MSACC 数据库连接、开启、关闭函数
    public String MSSql_Open_01()
    {
        String FH0 = "1";
        RootObject rb1 = JsonRO1(JSonDZ1);
        String MSSql_DZ01 = rb1.MSSql_1.server;
        String MSSql_KM01 = rb1.MSSql_1.dbname;
        String MSSql_YH01 = rb1.MSSql_1.user;
        String MSSql_MM01 = rb1.MSSql_1.password;
        String MSSql_Lj = "Data Source=" + MSSql_DZ01.Trim().ToString() + "; Initial Catalog=" + MSSql_KM01.Trim().ToString() + "; User ID=" + MSSql_YH01.Trim().ToString() + ";Password=" + MSSql_MM01.Trim().ToString();
        try
        {
            MSSqlCon_01 = new SqlConnection(MSSql_Lj.ToString());
            MSSqlCon_01.Open();
            FH0 = "0";
        }
        catch (Exception e)
        {
            //HttpContext.Current.Response.Write(e + "<br/>");
            FH0 = "1";
        }
        return FH0;
    }//MSSql_CZ1
    public void MSSql_Close_01()
    {
        try
        {
            try
            {
                MSSqlCon_01.Close();
            }
            catch (Exception e)
            {
                //HttpContext.Current.Response.Write(e + "<br/>");
            }
            MSSqlCon_01.Dispose();
            MSSqlCon_01 = null;
        }
        catch (Exception e)
        {
            //HttpContext.Current.Response.Write(e + "<br/>");
        }
        return;
    }//MSSql_Close_01
    public String Acc_Open_01()
    {
        String N_FHZ001 = "1";
        RootObject rb1 = JsonRO1(JSonDZ1);
        //String Acc_DZJMC01 = @"" + HttpContext.Current.Server.MapPath("~").ToString() + "/" + rb1.MSAcc_1.server + rb1.MSAcc_1.dbname;
        String Acc_DZJMC01 = HttpContext.Current.Server.MapPath("~/" + rb1.MSAcc_1.server).ToString() + "/" + rb1.MSAcc_1.dbname;
        String Acc_MM01 = rb1.MSAcc_1.password;
        #region
        if (File.Exists(Acc_DZJMC01.Trim().ToString()))
        {
            try
            {
                String ACClj01 = "Provider=Microsoft.Jet.OleDB.4.0;" + "Data Source=" + Acc_DZJMC01.Trim().ToString() + ";Persist Security Info=true; Jet OLEDB:Database Password=" + Acc_MM01.Trim().ToString() + ";";
                AccCon_01 = new OleDbConnection(ACClj01.ToString());
                if (AccCon_01.State == ConnectionState.Closed && AccCon_01.State != ConnectionState.Open)
                {
                    AccCon_01.Open();
                    N_FHZ001 = "0";
                }
                else
                {
                    N_FHZ001 = "1";
                }
            }
            catch
            {
                N_FHZ001 = "2";
            }
        }
        else
        {
            //HttpContext.Current.Response.Write(Acc_DZJMC01.Trim().ToString() + "文件不存在。<br/>");
            N_FHZ001 = "3";
        }
        #endregion
        return N_FHZ001.ToString();
    }//Acc_Open_01
    public void Acc_Close_01()
    {
        try
        {
            try
            {
                AccCon_01.Close();
            }
            catch (Exception e)
            {
                //HttpContext.Current.Response.Write(e + "<br/>");
            }
            AccCon_01.Close();
            AccCon_01.Dispose();
            AccCon_01 = null;
        }
        catch (Exception e)
        {
            // HttpContext.Current.Response.Write(e + "<br/>");
        }
        return;
    }//Acc_Close_01
    #endregion

    #region MSSQL MSACC操作集

    #region IDU1
    internal String _IDU1;
    public String IDU1
    {
        get
        {
            return _IDU1;
        }
        set
        {
            _IDU1 = value;
        }
    }//_IDU_0
    public string MSSql_IDU1()
    {
        String N_FHZ001 = "";
        String N_SQLYJ1 = "$WNUXLLY$SQL1";
        String MSSqlOpenPD1, MSAccOpenPD1;
        String SqlLXPD1 = SQLPD1.ToString().ToUpper();

        #region MSSQL执行
        if (SqlLXPD1.ToString() == "MSSQL")
        {
            MSSqlOpenPD1 = MSSql_Open_01().ToString();
            N_SQLYJ1 = IDU1;
            try
            {
                if (N_SQLYJ1 != "$WNUXLLY$SQL1")
                {
                    #region IDU、CR基础操作
                    SqlCommand MSSql_ComIDU;
                    MSSql_ComIDU = new SqlCommand(N_SQLYJ1.ToString(), MSSqlCon_01);
                    try
                    {
                        MSSql_ComIDU.ExecuteNonQuery();
                        MSSql_ComIDU.Connection.Close();
                        MSSql_ComIDU = null;
                        MSSql_Close_01();
                        N_FHZ001 = "0";
                    }
                    catch (Exception e)
                    {
                        MSSql_ComIDU.Connection.Close();
                        MSSql_ComIDU = null;
                        MSSql_Close_01();
                        N_FHZ001 = "$WNUXLLY$";
                    }//try
                    #endregion
                }
                else
                {
                    MSSql_Close_01();
                    N_FHZ001 = "$WNUXLLY$";
                }//if(N_SQLYJ1 != "$WNUXLLY$SQL1")
            }
            catch (Exception e)
            {
                MSSql_Close_01();
                N_FHZ001 = "$WNUXLLY$";
            }//try
        }//if (SqlLXPD1.ToString() == "MSSQL")
        #endregion

        #region MSACC执行
        if(SqlLXPD1.ToString() == "MSACC")
        {
            MSAccOpenPD1 = Acc_Open_01().ToString();
            N_SQLYJ1 = IDU1;
            try
            {
                if (N_SQLYJ1 != "$WNUXLLY$SQL1")
                {
                    #region IDU、CR基础操作
                    OleDbCommand MSAcc_ComIDU = new OleDbCommand();
                    MSAcc_ComIDU.Connection = AccCon_01;
                    MSAcc_ComIDU.CommandText = N_SQLYJ1.ToString();
                    try
                    {
                        MSAcc_ComIDU.ExecuteNonQuery();
                        MSAcc_ComIDU.Connection.Close();
                        MSAcc_ComIDU = null;
                        Acc_Close_01();
                        N_FHZ001 = "0";
                    }
                    catch (Exception e)
                    {
                        MSAcc_ComIDU.Connection.Close();
                        MSAcc_ComIDU = null;
                        Acc_Close_01();
                        N_FHZ001 = "$WNUXLLY$";
                    }//try
                    #endregion
                }
                else
                {
                    Acc_Close_01();
                    N_FHZ001 = "$WNUXLLY$";
                }//if(N_SQLYJ1 != "$WNUXLLY$SQL1")
            }catch (Exception e){
                Acc_Close_01();
                N_FHZ001 = "$WNUXLLY$";
            }//try 
        }//if(SqlLXPD1.ToString() == "MSACC")
        #endregion

        return N_FHZ001;
    }//MSSql_IDU1
    #endregion

    #region 查询记录数
    internal String _CXysSL1cs1;
    public String CXysSL1cs1
    {
        get
        {
            return _CXysSL1cs1;
        }
        set
        {
            _CXysSL1cs1 = value;
        }
    }//__CXysSL1cs1
    public string MSSql_CXysSL1()
    {
        String N_FHZ001 = "";
        String N_SQLYJ1 = "$WNUXLLY$SQL1";
        String MSSqlOpenPD1, MSAccOpenPD1;
        String SqlLXPD1 = SQLPD1.ToString().ToUpper();
        String Ncs1 = CXysSL1cs1;

        #region MSSql执行
        if (SqlLXPD1.ToString() == "MSSQL")
        {
            MSSqlOpenPD1 = MSSql_Open_01().ToString();
            N_SQLYJ1 = "select count(*) as Selsl1sl from " + Ncs1 + ";";
            try
            {
                if (N_SQLYJ1 != "$WNUXLLY$SQL1")
                {
                    #region SELECT1基础操作
                    SqlCommand MSSql_ComCXysSL1;
                    MSSql_ComCXysSL1 = new SqlCommand(N_SQLYJ1.ToString(), MSSqlCon_01);
                    SqlDataReader MSSqlrsCXysSL1 = MSSql_ComCXysSL1.ExecuteReader();
                    MSSqlrsCXysSL1.Read();
                    N_FHZ001 = MSSqlrsCXysSL1["Selsl1sl"].ToString();
                    MSSqlrsCXysSL1.Close();
                    MSSqlrsCXysSL1.Dispose();
                    MSSqlrsCXysSL1 = null;
                    MSSql_ComCXysSL1.Connection.Close();
                    MSSql_ComCXysSL1 = null;
                    MSSql_Close_01();
                    #endregion
                }
                else
                {
                    MSSql_Close_01();
                    N_FHZ001 = "$WNUXLLY$";
                }//if(N_SQLYJ1 != "$WNUXLLY$SQL1")
            }
            catch (Exception e)
            {
                MSSql_Close_01();
                N_FHZ001 = "$WNUXLLY$";
            }//try
        }//if (SqlLXPD1.ToString() == "MSSQL")
        
        #endregion

        #region  MSACC执行
        if(SqlLXPD1.ToString() == "MSACC")
        {

            MSAccOpenPD1 = Acc_Open_01().ToString();
            N_FHZ001 = MSAccOpenPD1;
            N_SQLYJ1 = "select count(*) as Selsl1sl from " + Ncs1 + ";";
            try
            {
                if (N_SQLYJ1 != "$WNUXLLY$SQL1")
                {
                    OleDbCommand MSAcc_ComIDU = new OleDbCommand();
                    MSAcc_ComIDU.Connection = AccCon_01;
                    MSAcc_ComIDU.CommandText = N_SQLYJ1.ToString();
                    OleDbDataReader MSAccrsCXysSL1 = MSAcc_ComIDU.ExecuteReader();
                    MSAccrsCXysSL1.Read();
                    N_FHZ001 = MSAccrsCXysSL1["Selsl1sl"].ToString();
                    MSAccrsCXysSL1.Close();
                    MSAccrsCXysSL1.Dispose();
                    MSAccrsCXysSL1 = null;
                    MSAcc_ComIDU.Connection.Close();
                    MSAcc_ComIDU = null;
                    Acc_Close_01();
                }
                else
                {
                    Acc_Close_01();
                    N_FHZ001 = "$WNUXLLY$";
                }//if (N_SQLYJ1 != "$WNUXLLY$SQL1")
            }
            catch (Exception e)
            {
                Acc_Close_01();
                N_FHZ001 = "$WNUXLLY$";
            }//try
        }//if (SqlLXPD1.ToString() == "MSACC") 
        #endregion

        return N_FHZ001;
    }//MSSql_CXysSL1
    #endregion

    #region 通过序号获取数据
    internal String _CXysZD1cs1;
    public String CXysZD1cs1
    {
        get
        {
            return _CXysZD1cs1;
        }
        set
        {
            _CXysZD1cs1 = value;
        }
    }//_CXysZD1cs1
    internal String _CXysZD1cs2;
    public String CXysZD1cs2 { 
        get 
        { 
            return _CXysZD1cs2; 
        } 
        set 
        { 
            _CXysZD1cs2 = value; 
        } 
    }//_CXysZD1cs1
    internal String _CXysZD1cs3;
    public String CXysZD1cs3
    {
        get
        {
            return _CXysZD1cs3;
        }
        set
        {
            _CXysZD1cs3 = value;
        }
    }//_CXysZD1cs1
    public string MSSql_CXysZD1()
    {
        String N_FHZ001 = "";
        String N_SQLYJ1 = "$WNUXLLY$SQL1";
        String MSSqlOpenPD1, MSAccOpenPD1;
        String SqlLXPD1 = SQLPD1.ToString().ToUpper();
        String Ncs1 = "$WnXoY$", Ncs2 = "*", Ncs3 = "$NULL$";
        Ncs1 = CXysZD1cs1 == null ? Ncs1 : CXysZD1cs1;
        Ncs2 = CXysZD1cs2 == null ? Ncs2 : CXysZD1cs2;
        Ncs3 = CXysZD1cs3 == null ? Ncs3 : CXysZD1cs3;

        #region MSSQL执行
        if (SqlLXPD1.ToString() == "MSSQL"&&Ncs1.ToString() !="$WnXoY$")
        {
            MSSqlOpenPD1 = MSSql_Open_01().ToString();
            N_SQLYJ1 = "select " + Ncs2 + " from " + Ncs1;
            if (Ncs3 != "$NULL$")
            {
                N_SQLYJ1 = N_SQLYJ1 + " " + Ncs3;
			}
            N_SQLYJ1 = N_SQLYJ1 + ";";
            try
            {
                if (N_SQLYJ1 != "$WNUXLLY$SQL1")
                {
                    #region SELECT1基础操作
                    SqlCommand MSSql_ComCXysZD1;
                    MSSql_ComCXysZD1 = new SqlCommand(N_SQLYJ1.ToString(), MSSqlCon_01);
                    SqlDataReader MSSqlrsCXysZD1 = MSSql_ComCXysZD1.ExecuteReader();
                    int CXysZD1ii1,CXysZD1iii1=0,CXysZD1leijl1=0;
                    N_FHZ001 = "";
                    while (MSSqlrsCXysZD1.Read())
                    {
                        CXysZD1ii1 = MSSqlrsCXysZD1.FieldCount;
                        CXysZD1iii1 = 0;
                        if (CXysZD1leijl1 != 0)
                        {
                            N_FHZ001 = N_FHZ001 + "$1$";
                        }//if
                        while (CXysZD1iii1 < CXysZD1ii1)
                        {
                            if (CXysZD1iii1 > 0)
                            {
                                N_FHZ001 = N_FHZ001 + "$2$";
                            }//
                            N_FHZ001 = N_FHZ001 + MSSqlrsCXysZD1[CXysZD1iii1];
                            CXysZD1iii1 = CXysZD1iii1 + 1;
                        }//
                        CXysZD1iii1 = 0;
                        CXysZD1leijl1 = CXysZD1leijl1 + 1;
                    }//while(MSSqlrsCXysSL1
                    CXysZD1leijl1 = 0;
                    MSSqlrsCXysZD1.Close();
                    MSSqlrsCXysZD1.Dispose();
                    MSSqlrsCXysZD1 = null;
                    MSSql_ComCXysZD1.Connection.Close();
                    MSSql_ComCXysZD1 = null;
                    MSSql_Close_01();
                    #endregion
                }
                else
                {
                    MSSql_Close_01();
                    N_FHZ001 = "$WNUXLLY$";
                }//if(N_SQLYJ1 != "$WNUXLLY$SQL1")
            }
            catch (Exception e)
            {
                MSSql_Close_01();
                N_FHZ001 = "$WNUXLLY$";
            }//try

        }//if (SqlLXPD1.ToString() == "MSSQL"&&Ncs1.ToString() !="$WnXoY$")
        
        #endregion

        #region MSACC执行
        if (SqlLXPD1.ToString() == "MSACC" && Ncs1.ToString() != "$WnXoY$")
        {
            MSAccOpenPD1 = Acc_Open_01().ToString();
            N_SQLYJ1 = "select " + Ncs2 + " from " + Ncs1;
            if (Ncs3 != "$NULL$")
            {
                N_SQLYJ1 = N_SQLYJ1 + " " + Ncs3;
            }
            N_SQLYJ1 = N_SQLYJ1 + ";";
            try
            {
                if (N_SQLYJ1 != "$WNUXLLY$SQL1")
                {
                    OleDbCommand MSAcc_ComIDU = new OleDbCommand();
                    MSAcc_ComIDU.Connection = AccCon_01;
                    MSAcc_ComIDU.CommandText = N_SQLYJ1.ToString();
                    OleDbDataReader MSAccrsCXysSL1 = MSAcc_ComIDU.ExecuteReader();
                    int CXysZD1ii1, CXysZD1iii1 = 0, CXysZD1leijl1 = 0;
                    N_FHZ001 = "";
                    while (MSAccrsCXysSL1.Read())
                    {
                        CXysZD1ii1 = MSAccrsCXysSL1.FieldCount;
                        CXysZD1iii1 = 0;
                        if (CXysZD1leijl1 != 0)
                        {
                            N_FHZ001 = N_FHZ001 + "$1$";
                        }//if
                        while (CXysZD1iii1 < CXysZD1ii1)
                        {
                            if (CXysZD1iii1 > 0)
                            {
                                N_FHZ001 = N_FHZ001 + "$2$";
                            }//
                            N_FHZ001 = N_FHZ001 + MSAccrsCXysSL1[CXysZD1iii1];
                            CXysZD1iii1 = CXysZD1iii1 + 1;
                        }//
                        CXysZD1iii1 = 0;
                        CXysZD1leijl1 = CXysZD1leijl1 + 1;
                    }//while(MSSqlrsCXysSL1
                    CXysZD1leijl1 = 0;
                    MSAccrsCXysSL1.Close();
                    MSAccrsCXysSL1.Dispose();
                    MSAccrsCXysSL1 = null;
                    MSAcc_ComIDU.Connection.Close();
                    MSAcc_ComIDU = null;
                    Acc_Close_01();
                }
                else
                {
                    Acc_Close_01();
                    N_FHZ001 = "$WNUXLLY$";
                }// if (N_SQLYJ1 != "$WNUXLLY$SQL1")
            }
            catch (Exception e)
            {
                Acc_Close_01();
                N_FHZ001 = "$WNUXLLY$";
            }//try

        }//if (SqlLXPD1.ToString() == "MSACC" && Ncs1.ToString() != "$WnXoY$")
        #endregion

        return N_FHZ001;
    }//MSSql_CXysZD1
    #endregion

    #region 字段查询
    internal String _CXysZD2cs1;
    public String CXysZD2cs1
    {
        get
        {
            return _CXysZD2cs1;
        }
        set
        {
            _CXysZD2cs1 = value;
        }
    }//_CXysZD1cs1
    internal String _CXysZD2cs2;
    public String CXysZD2cs2
    {
        get
        {
            return _CXysZD2cs2;
        }
        set
        {
            _CXysZD2cs2 = value;
        }
    }//_CXysZD1cs1
    internal String _CXysZD2cs3;
    public String CXysZD2cs3
    {
        get
        {
            return _CXysZD2cs3;
        }
        set
        {
            _CXysZD2cs3 = value;
        }
    }//_CXysZD1cs1
    internal String[] _CXysZD2cs4;
    public String[] CXysZD2cs4
    {
        get
        {
            return _CXysZD2cs4;
        }
        set
        {
            _CXysZD2cs4 = value;
        }
    }//_CXysZD1cs1
    internal String _CXysZD2cs5;
    public String CXysZD2cs5
    {
        get
        {
            return _CXysZD2cs5;
        }
        set
        {
            _CXysZD2cs5 = value;
        }
    }//_CXysZD1cs1
    public string MSSql_CXysZD2()
    {
        String N_FHZ001 = "";
        String N_SQLYJ1 = "$WNUXLLY$SQL1";
        String MSSqlOpenPD1, MSAccOpenPD1;
        String SqlLXPD1 = SQLPD1.ToString().ToUpper();
        String Ncs1 = "$WnXoY$", Ncs2 = "*", Ncs3 = "$NULL$", Ncs5 = "$WsXzY$";
        String[] Ncs4 = new String[100001];
        Ncs1 = CXysZD2cs1 == null ? Ncs1 : CXysZD2cs1;
        Ncs2 = CXysZD2cs2 == null ? Ncs2 : CXysZD2cs2;
        Ncs3 = CXysZD2cs3 == null ? Ncs3 : CXysZD2cs3;
        Ncs4 = CXysZD2cs4 == null ? Ncs4 : CXysZD2cs4;
        Ncs5 = CXysZD2cs5 == null ? Ncs5 : CXysZD2cs5;

        #region MSSQL执行
        if (SqlLXPD1.ToString() == "MSSQL" && Ncs1.ToString() != "$WnXoY$")
        {
            MSSqlOpenPD1 = MSSql_Open_01().ToString();
            N_SQLYJ1 = "select " + Ncs2 + " from " + Ncs1;
            if (Ncs3 != "$NULL$")
            {
                N_SQLYJ1 = N_SQLYJ1 + " " + Ncs3;
            }
            N_SQLYJ1 = N_SQLYJ1 + ";";

            try
            {
                if (N_SQLYJ1 != "$WNUXLLY$SQL1")
                {// && Ncs5 != "$WsXzY$"
                    #region SELECT1基础操作
                    SqlCommand MSSql_ComCXysZD2;
                    MSSql_ComCXysZD2 = new SqlCommand(N_SQLYJ1.ToString(), MSSqlCon_01);
                    SqlDataReader MSSqlrsCXysZD2 = MSSql_ComCXysZD2.ExecuteReader();
                    int CXysZD1leijl1 = 0, CXysZD1szsl1 = Ncs4.Length, iiszsl1 = 0;
                    CXysZD1szsl1 = Ncs5 != "$WsXzY$" ? Convert.ToInt16(Ncs5.ToString()):CXysZD1szsl1;
                    N_FHZ001 = "";
                    if (Ncs4.Length != 100001)
                    {
                        while (MSSqlrsCXysZD2.Read())
                        {
                            if (CXysZD1leijl1 != 0)
                            {
                                N_FHZ001 = N_FHZ001 + "$1$";
                            }//if

                            while (iiszsl1 < CXysZD1szsl1)
                            {
                                if (iiszsl1 == 0)
                                {
                                    N_FHZ001 = N_FHZ001 + MSSqlrsCXysZD2[Ncs4[iiszsl1].ToString()];
                                }
                                else
                                {
                                    N_FHZ001 = N_FHZ001 + "$2$" + MSSqlrsCXysZD2[Ncs4[iiszsl1].ToString()];
                                }
                                iiszsl1 = iiszsl1 + 1;
                            }//
                            iiszsl1 = 0;
                            CXysZD1leijl1 = CXysZD1leijl1 + 1;
                        }//while(MSSqlrsCXysSL1
                    }
                    else
                    {
                        N_FHZ001 = "$WNUXLLY$";
                    }
                    CXysZD1leijl1 = 0;
                    MSSqlrsCXysZD2.Close();
                    MSSqlrsCXysZD2.Dispose();
                    MSSqlrsCXysZD2 = null;
                    MSSql_ComCXysZD2.Connection.Close();
                    MSSql_ComCXysZD2 = null;
                    MSSql_Close_01();
                    #endregion
                }
                else
                {
                    MSSql_Close_01();
                    N_FHZ001 = "$WNUXLLY$";
                }//if(N_SQLYJ1 != "$WNUXLLY$SQL1")
            }
            catch (Exception e)
            {
                MSSql_Close_01();
                N_FHZ001 = "$WNUXLLY$";
            }//try

        }// if (SqlLXPD1.ToString() == "MSSQL" && Ncs1.ToString() != "$WnXoY$")

        #endregion

        #region MSACC执行
        if (SqlLXPD1.ToString() == "MSACC" && Ncs1.ToString() != "$WnXoY$")
        {
            MSAccOpenPD1 = Acc_Open_01().ToString();
            N_SQLYJ1 = "select " + Ncs2 + " from " + Ncs1;
            if (Ncs3 != "$NULL$")
            {
                N_SQLYJ1 = N_SQLYJ1 + " " + Ncs3;
            }
            N_SQLYJ1 = N_SQLYJ1 + ";";
            //N_FHZ001 = N_SQLYJ1;
            /*  */
            try {
                if (N_SQLYJ1 != "$WNUXLLY$SQL1")
                {// && Ncs5 != "$WsXzY$"
                    OleDbCommand MSAcc_ComIDU = new OleDbCommand();
                    MSAcc_ComIDU.Connection = AccCon_01;
                    MSAcc_ComIDU.CommandText = N_SQLYJ1.ToString();
                    OleDbDataReader MSAccrsCXysSL1 = MSAcc_ComIDU.ExecuteReader();
                    int CXysZD1leijl1 = 0, CXysZD1szsl1 = Ncs4.Length, iiszsl1 = 0;
                    CXysZD1szsl1 = Ncs5 != "$WsXzY$" ? Convert.ToInt16(Ncs5.ToString()) : CXysZD1szsl1;
                    N_FHZ001 = "";
                    if (Ncs4.Length != 100001)
                    {
                        while (MSAccrsCXysSL1.Read())
                        {
                            if (CXysZD1leijl1 != 0)
                            {
                                N_FHZ001 = N_FHZ001 + "$1$";
                            }//if

                            while (iiszsl1 < CXysZD1szsl1)
                            {
                                if (iiszsl1 == 0)
                                {
                                    N_FHZ001 = N_FHZ001 + MSAccrsCXysSL1[Ncs4[iiszsl1].ToString()];
                                }
                                else
                                {
                                    N_FHZ001 = N_FHZ001 + "$2$" + MSAccrsCXysSL1[Ncs4[iiszsl1].ToString()];
                                }
                                iiszsl1 = iiszsl1 + 1;
                            }//
                            iiszsl1 = 0;
                            CXysZD1leijl1 = CXysZD1leijl1 + 1;
                        }//while(MSSqlrsCXysSL1
                    }
                    else {
                        N_FHZ001 = "$WNUXLLY$";
                    }
                    CXysZD1leijl1 = 0;
                    MSAccrsCXysSL1.Close();
                    MSAccrsCXysSL1.Dispose();
                    MSAccrsCXysSL1 = null;
                    MSAcc_ComIDU.Connection.Close();
                    MSAcc_ComIDU = null;
                    Acc_Close_01();
                }
                else {
                    Acc_Close_01();
                    N_FHZ001 = "$WNUXLLY$";
                }//if (N_SQLYJ1 != "$WNUXLLY$SQL1"
            }
            catch (Exception e) 
            {
                Acc_Close_01();
                N_FHZ001 = "$WNUXLLY$";
            }//try
           
        }//if (SqlLXPD1.ToString() == "MSACC" && Ncs1.ToString() != "$WnXoY$")
        #endregion

        return N_FHZ001;
    }//MSSql_CXysZD2
    #endregion

    //MSSQL操作集 IDU1 wei
    #endregion



   





    #region C# NEWTONSOFT.JSON读取json数据连接文件文件
    public RootObject JsonRO1(String CS1)
    {
        String Str1 = "";
        //StreamReader sr = File.OpenText(@"" + HttpContext.Current.Server.MapPath("~").ToString() + @"\File\Data_xx.json");
       // StreamReader sr = File.OpenText(@"" + HttpContext.Current.Server.MapPath("~").ToString() + CS1.ToString());
        StreamReader sr = File.OpenText(CS1.ToString());
        String nextLine;
        while ((nextLine = sr.ReadLine()) != null)
        {
            Str1 = Str1 + nextLine;
        }
        sr.Close();
        RootObject N_rb1 = JsonConvert.DeserializeObject<RootObject>(Str1.ToString());
        return N_rb1;
    }//JsonRO1
    public class MySql_1
    {
        public string server { get; set; }
        public string user { get; set; }
        public string password { get; set; }
        public string dbname { get; set; }
    }
    public class Sqltiel_1
    {
        public string server { get; set; }
        public string user { get; set; }
        public string password { get; set; }
        public string dbname { get; set; }
    }
    public class MSSql_1
    {
        public string server { get; set; }
        public string user { get; set; }
        public string password { get; set; }
        public string dbname { get; set; }
    }
    public class MSAcc_1
    {
        public string server { get; set; }
        public string user { get; set; }
        public string password { get; set; }
        public string dbname { get; set; }
    }
    public class RootObject
    {
        public MySql_1 MySql_1 { get; set; }
        public Sqltiel_1 Sqltiel_1 { get; set; }
        public MSSql_1 MSSql_1 { get; set; }
        public MSAcc_1 MSAcc_1 { get; set; }
    }
    #endregion

}///public class wxyS_DataS_1 wei


#region MSsql操作实例
/*
SQLSL1.SQLPD1 = "MSSQL";
SQLSL1.CXysZD1cs1 = "sy1";
//SQLSL1.CXysZD1cs2 = "dm,rqsjd,rqsji,bj1";
SQLSL1.CXysSL1cs1 = "sy1";
SQLSL1.CXysZD2cs1 = "sy1";
SQLSL1.CXysZD2cs5 = "yes";
String[] FZ4 = {"id", "dm", "rqsjd", "rqsji", "bj1" };
SQLSL1.CXysZD2cs4 = FZ4;
context.Response.Write(SQLSL1.MSSql_CXysSL1() + "<br/><br/>" + SQLSL1.MSSql_CXysZD1() + "<br/><br/>" + SQLSL1.MSSql_CXysZD2());
SQLSL1.MSSql_Open_01();
SqlCommand PageCom1;
String SqlStr1 = "select * from sy1",DataFH1="";
PageCom1 = new SqlCommand(SqlStr1.ToString(), SQLSL1.MSSqlCon_01);
SqlDataReader Pagers1 = PageCom1.ExecuteReader();
int CXysZD1leijl1 = 0;
while (Pagers1.Read())
{
if (CXysZD1leijl1 != 0)
{
DataFH1 = DataFH1 + "__$1$";
}//if
DataFH1 = DataFH1 + Pagers1["dm"] + "$2$";
DataFH1 = DataFH1 + Pagers1["rqsjd"] + "$2$";
DataFH1 = DataFH1 + Pagers1["rqsji"] + "$2$";
DataFH1 = DataFH1 + Pagers1["bj1"];
CXysZD1leijl1 = CXysZD1leijl1 + 1;
}//while(MSSqlrsCXysSL1
CXysZD1leijl1 = 0;
Pagers1.Close();
Pagers1.Dispose();
Pagers1 = null;
PageCom1.Connection.Close();
PageCom1 = null;
SQLSL1.MSSql_Close_01();
context.Response.Write(DataFH1);
*/
/*
select top X * from TABLENAME where id not in(select top Y id from TABLENAME order by id)  order by id;
此语句SQLserver ACCESS支持。X每页记录数，Y当前页数-1。ACCESS 在查询第1页的时候无法使用应为ACCESS不支持top 0。所以ACCESS第1页为select top X * from TABLENAME。
*/
#endregion